<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets" 
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    
    <ui:composition template="/WEB-INF/faces/template.xhtml">

    <ui:define name="title">ViewRooms</ui:define>

        <ui:define name="content">
            
            <!-- Check admin login -->
            <ui:include src="/resources/include/checkAdminLogin.xhtml" />
            
            <h:form>            
                <p:dataTable id="rooms" value="#{viewRoomsControllerBean.rooms}" var="room">

                    <p:column sortBy="#{room.roomNb}" >
                        <f:facet name="header">
                            <h:outputText value="Room Number" />
                        </f:facet>
                        <h:outputText value="#{room.roomNb}" />
                    </p:column>

                    <p:column sortBy="#{room.bathRoom}" >
                        <f:facet name="header">
                            <h:outputText value="Bath Room" />
                        </f:facet>
                        <h:outputText value="#{room.bathRoom}" />
                    </p:column>

                    <p:column sortBy="#{room.kitchen}" >
                        <f:facet name="header">
                            <h:outputText value="Kitchen" />
                        </f:facet>
                        <h:outputText value="#{room.kitchen}" />
                    </p:column>
                    
                    <p:column sortBy="#{room.roomNb}" >
                        <f:facet name="header">
                            <h:outputText value="Room Type" />
                        </f:facet>
                        <h:outputText value="#{room.roomType}" />
                    </p:column>
                    
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Remove room" />
                        </f:facet>
                        <h:commandButton value="Remove room" action="#{viewRoomsControllerBean.removeRoom(viewRoomsControllerBean.getRoom(room.id))}"/>
                    </p:column>

                </p:dataTable>
            </h:form>
        </ui:define>
    
    </ui:composition>
</html>

